import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
import { rules } from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
import { JVxeTypes, JVxeColumn } from '/@/components/jeecg/JVxeTable/types'
import { defHttp } from '/@/utils/http/axios';
import { url } from 'inspector';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '器具名称',
    align: "center",
    dataIndex: 'uteName'
  },
  {
    title: '器具自编号',
    align: "center",
    dataIndex: 'uteNumber'
  },
  {
    title: '出厂编号',
    align: "center",
    dataIndex: 'manuNumber'
  },
  // {
  //   title: '型号/规格/等级',
  //   align: "center",
  //   dataIndex: 'specification'
  // },
  {
    title: '测量范围',
    align: "center",
    dataIndex: 'usableRange'
  },
  {
    title: '用途',
    align: "center",
    dataIndex: 'purpose'
  },
  // {
  //   title: '责任人',
  //   align: "center",
  //   dataIndex: 'personResponsible',
  // },
  {
    title: '责任人',
    align: "center",
    dataIndex: 'personResponsibleName',
  },
  {
    title: '存放位置',
    align: "center",
    dataIndex: 'storageLocation'
  },

  {
    title: '有效截止日期',
    align: "center",
    dataIndex: 'expirationDate',
    customRender: ({ text }) => {
      return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text);
    },
  },

  {
    title: '器具照片',
    align: "center",
    dataIndex: 'utePicture',
    customRender: render.renderImage,
  },
  {
    title: '规程文件',
    align: "center",
    dataIndex: 'instructions',
    slots: { customRender: 'fileSlot' },
  },
];

export const columnsCheck: BasicColumn[] = [
  {
    title: '器具名称',
    align: "center",
    dataIndex: 'uteName'
  },
  {
    title: '器具自编号',
    align: "center",
    dataIndex: 'uteNumber'
  },
  {
    title: '出厂编号',
    align: "center",
    dataIndex: 'manuNumber'
  },
  {
    title: '测量范围',
    align: "center",
    dataIndex: 'usableRange'
  },
  {
    title: '用途',
    align: "center",
    dataIndex: 'purpose'
  },
  {
    title: '责任人',
    align: "center",
    dataIndex: 'personResponsibleName'
  },
  {
    title: '存放位置',
    align: "center",
    dataIndex: 'storageLocation'
  },
  {
    title: '有效截止日期',
    align: "center",
    dataIndex: 'expirationDate',
    customRender: ({ text }) => {
      return !text ? "" : (text.length > 10 ? text.substr(0, 10) : text);
    },
  },
  {
    title: '溯源方式',
    align: "center",
    dataIndex: 'traceabilityMethod'
  },
  {
    title: '是否现场检定',
    align: "center",
    dataIndex: 'fieldInspect'
  },

];
export const columnsHead: BasicColumn[] = [
  {
    title: '器具状态',
    align: "center",
    dataIndex: 'status'
  },
  {
    title: '器具名称',
    align: "center",
    dataIndex: 'uteName'
  },
  {
    title: '器具自编号',
    align: "center",
    dataIndex: 'uteNumber'
  },
  {
    title: '出厂编号',
    align: "center",
    dataIndex: 'manuNumber'
  },
  {
    title: '责任人',
    align: "center",
    dataIndex: 'personResponsibleName'
  },
  {
    title: '存放位置',
    align: "center",
    dataIndex: 'storageLocation'
  },

  {
    title: '器具照片',
    align: "center",
    dataIndex: 'utePicture',
    customRender: render.renderImage,
  },

];

//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: "器具名称",
    field: 'uteName',
    component: 'Input',
    colProps: { span: 6 },
  },
  {
    label: "型号/规格/等级",
    field: 'specification',
    component: 'Input',
    colProps: { span: 6 },
  },
];
export const labUtensilChecklistColumns: JVxeColumn[] = [
  {
    title: '器具名称',
    key: 'uteName',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '型号规格',
    key: 'specification',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '出厂编号',
    key: 'manuNumber',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '责任人',
    key: 'personResponsible',
    type: JVxeTypes.input,
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '是否现场校验',
    key: 'fieldInspect',
    type: JVxeTypes.input,
    // options: [],
    // dictCode: "yn",
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
  {
    title: '溯源方式',
    key: 'traceabilityMethod',
    type: JVxeTypes.input,
    // options: [],
    // dictCode: "last_type",
    width: "200px",
    placeholder: '请输入${title}',
    defaultValue: '',
  },
]
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '器具名称',
    field: 'uteName',
    component: 'Input',
  },
  {
    label: '器具自编号',
    field: 'uteNumber',
    component: 'Input',
  },
  {
    label: '出厂编号',
    field: 'manuNumber',
    component: 'Input',
  },
  {
    label: '型号/规格/等级',
    field: 'specification',
    component: 'Input',
  },
  {
    label: '测量范围',
    field: 'usableRange',
    component: 'Input',
  },
  {
    label: '用途',
    field: 'purpose',
    component: 'Input',
  },
  {
    label: '设备分类(A/B/C/D)',
    field: 'sort',
    component: 'Input',
  },
  {
    label: '责任人',
    field: 'personResponsible',
    component: 'Input',
  },
  {
    label: '存放位置',
    field: 'storageLocation',
    component: 'Input',
  },
  {
    label: '检定参数/送检项',
    field: 'heckItem',
    component: 'Input',
  },
  {
    label: '溯源方式',
    field: 'traceabilityMethod',
    component: 'Input',
  },
  {
    label: '是否现场检定',
    field: 'fieldInspect',
    component: 'Input',
  },
  {
    label: '检定周期/(月)',
    field: 'inspectCycle',
    component: 'InputNumber',
  },
  {
    label: '上次检定日期',
    field: 'lastInspectDate',
    component: 'DatePicker',
  },
  {
    label: '有效截止日期',
    field: 'expirationDate',
    component: 'DatePicker',
  },
  {
    label: '计划送检日期',
    field: 'planInspectDate',
    component: 'DatePicker',
  },
  {
    label: '确认结果',
    field: 'confirmResult',
    component: 'Input',
  },
  {
    label: '确认人',
    field: 'confirmPerson',
    component: 'Input',
  },
  {
    label: '备注',
    field: 'remark',
    component: 'InputTextArea',
  },
  {
    label: '器具照片',
    field: 'utePicture',
    component: 'JImageUpload',
    componentProps: {
    },
  },
  {
    label: '规程文件',
    field: 'instructions',
    component: 'JUpload',
    componentProps: {
    },
  },



  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];
